<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>user agent</title>
</head>
<body>
    
    <div>
        用户代理： <span id="userAgent"></span>

        &nbsp;&nbsp; <input type="button" value="复制" id="copyUa">
    </div>
    
    <script src="./js/clipboard.min.js"></script>
    <script>
        var uaDom = document.getElementById('userAgent')
        var copyUaBtn = document.getElementById("copyUa")


        var ua = navigator.userAgent
        uaDom.innerHTML = ua

        copyUaBtn.onclick = function () {
            clipboardCopy(ua)
            alert('复制成功')
        }

    </script>
</body>
</html>